﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>登录</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<jsp:include page="/page/common/util/commonCssLoder.jsp" flush="true" />
		
		<jsp:include page="/page/common/util/jquery-loder.jsp" flush="true" />
		<jsp:include page="/page/common/util/sha1-loder.jsp" flush="true" />
		
		<link rel="stylesheet" type="text/css" href="<%=path%>/css/basic/login/loginStyle.css" />
		
		<style type="text/css">
			.rowDiv{
				margin-top: 20px;
			}
			
			/** 伪背景图片 **/
			.fullScreenImg{
				position: absolute;
				width: 100%;
				height: 100%;
				
				filter: alpha(opacity=80);
				-moz-opacity: 0.8;
				-khtml-opacity: 0.8;
				opacity: 0.8;
			}
			.fullScreen{
				position: absolute;
				width: 100%;
				height: 100%;
			}
			
			
			
			.loginMessage{
				font-size: 13px;
				color: #ff0000;
				text-align: center;
				height: 25px;
				line-height: 25px;
			}
			
			
		</style>
		
		<script type="text/javascript">
			
			/** 鼠标hover **/
			function hoverLoginBtn(type){
				if(type == 1){//鼠标悬浮
					$("#loginBtnDiv").attr("class", "submitLoginBtnHover");
				}else{
					$("#loginBtnDiv").attr("class", "submitLoginBtn");
				}
			}
			
			function goLogin(){
				var userName = $("#userName").val();
				var password = $("#expressPassword").val();
				
				if(userName == "" || password == ""){
					$("#errorMsgDiv").text("用户名或密码不能为空！");
				}else{
					$("#errorMsgDiv").text("");
					
					var sha1Password = hex_sha1(password);
					$("#encryptPassword").val(sha1Password);
					
					document.getElementById("loginForm").submit();
				}
			}
			
			function enterPress(e){//传入 event
				var e = e || window.event;
				if(e.keyCode == 13){
					goLogin();
				}
			}
			
			/** 获得随机整数 **/
			function randomInt(min, max){
				var ran = max - min + 1;
				
				var number = Math.floor(Math.random() * ran) + min;
				
				return number;
			}
			
			/** 随机显示背景图 **/
			function displayBackground(){
				var basicSrc = "";
				var bgImgArray = [];
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_01origin_01_2015129132591B.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_02origin_03_20151291325D4D.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_04origin_07_20151291325DA9.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_13origin_25_20151291325E22.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_14origin_27_201512913256E4.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_16origin_31_20151291325352.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_18origin_35_201512913251CA.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_20origin_39_20151291325E72.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_24origin_47_20151291325A92.jpg");
				bgImgArray.push("http://img1.gamersky.com/image2015/01/20150124zy_1/gamersky_21origin_41_201512913255FA.jpg");
				bgImgArray.push("http://2a.zol-img.com.cn/product/104/100/cesDThfLzlVac.jpg");
				bgImgArray.push("http://www.uc129.com/uploads/allimg/150108/1-15010R35953M7.jpg");
				
				/** ==================================== **/
				var index = randomInt(0, bgImgArray.length - 1);
				
				var imgSrc = basicSrc + bgImgArray[index];
				
				$("#bgImg").attr('src', imgSrc);
			}
		</script>
	</head>

	<body class="bodyCommonStyle" onkeypress="enterPress()">
		<img id="bgImg" class="fullScreenImg"/>
		<div class="fullScreen"></div>
		<div>
			<table class="pageBodyTable" align="center" cellpadding="0" cellspacing="0">
				<tr class="pageHeaderPartRow"><!-- 页眉 -->
					<td>
						<div></div>
					</td>
				</tr>
				<tr valign="top" align="center"><!-- 正文 -->
					<td>
						<div class="contentMiddleRevis" style="width: 350px;">
							
							<div id="loginBlock">
								<!-- 半透明DIV -->
								<div class="transparentBlock">
									<div id="loginBlockTop"></div>
									<div id="loginBlockMiddle"></div>
									<div id="loginBlockBottom"></div>
								</div>
								<!-- 不透明的DIV -->
								<div class="fullShowBlock">
									<form action="login" method="post" id="loginForm">
										<div class="loginHeader">管理登录</div>
										
										<!-- 账号 -->
										<div class="blockInput">
											
											<div class="blockInputLeft"></div>
											
											<div class="blockInputMiddle">
												<div class="emailIcon"></div>
												<div class="textInputDiv">
													<input type="text" id="userName" name="loginUser.userName" value="${userName}" />
												</div>
											</div>
											
											<div class="blockInputRight"></div>
										</div>
										
										<!-- 密码 -->
										<div class="blockInput">
											
											<div class="blockInputLeft"></div>
											
											<div class="blockInputMiddle">
												<div class="pwdIcon"></div>
												<div class="textInputDiv">
													<input type="password" id="expressPassword" />
													<!-- 加密密码 -->
													<input type="hidden" id="encryptPassword" name="loginUser.password" />
												</div>
											</div>
											
											<div class="blockInputRight"></div>
										</div>
										<div class="loginMessage" id="errorMsgDiv">
											${loginErrorMsg}
										</div>
										<div id="loginBtnDiv" class="submitLoginBtn" onclick="goLogin()" onmouseover="hoverLoginBtn(1)" onmouseout="hoverLoginBtn(0)"></div>
									</form>
								</div>
								
							</div>
						</div>
					</td>
				</tr>
				<tr class="pageFooterPartRow"><!-- 页脚 -->
					<td>
						<div></div>
					</td>
				</tr>
			</table>
		</div>
		
		<script type="text/javascript">
			displayBackground();
		</script>
	</body>
	
</html>
